package org.penguin.study.bk.dict.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.penguin.study.bk.dict.entity.SysDictItem;

import java.util.List;

@Mapper
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
    @Select("SELECT * FROM sys_dict_item WHERE dict_id = #{mainId} order by sort_order asc, item_value asc")
    public List<SysDictItem> selectItemsByMainId(String mainId);

    @Select("select sdi.* from sys_dict_item sdi left join sys_dict sd on sd.id = sdi.dict_id where sd.dict_code = #{code}")
    List<SysDictItem> getDataByCode(@Param(value = "code") String code);
}